import requests

# 获取百度页面的头部信息
r = requests.head("http://www.baidu.com/")

print(r.headers)

# 返回的结果
# {'Cache-Control': 'private, no-cache, no-store, proxy-revalidate, no-transform', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Content-Type': 'text/html', 'Date': 'Wed, 15 Nov 2023 05:19:21 GMT', 'Last-Modified': 'Mon, 13 Jun 2016 02:50:25 GMT', 'Pragma': 'no-cache', 'Server': 'bfe/1.0.8.18'}
